<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="Lista de Roles"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:form styleClass="jsfcrud_list_form">
                <p:growl showDetail="true"/>
                <h:outputText escape="false" value="No hay registros..." rendered="#{rolController.items.rowCount == 0}"/>
                <h:panelGroup rendered="#{rolController.items.rowCount > 0}">
                    <h:outputText value="#{rolController.pagination.pageFirstItem + 1}..#{rolController.pagination.pageLastItem + 1}/#{rolController.pagination.itemsCount}"/>&nbsp;
                    <h:commandLink action="#{rolController.previous}" value="#{bundle.Previous} #{rolController.pagination.pageSize}" rendered="#{rolController.pagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{rolController.next}" value="#{bundle.Next} #{rolController.pagination.pageSize}" rendered="#{rolController.pagination.hasNextPage}"/>&nbsp;
                    <p:dataTable id="dataTable" value="#{rolController.items}" var="item" >
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Código"/>
                            </f:facet>
                            <h:outputText value="#{item.codigo}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Descripción"/>
                            </f:facet>
                            <h:outputText value="#{item.descripcion}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:outputText value=" "/>
                            <p:commandButton action="#{rolController.prepareEdit}" value="Editar" ajax="false"/>
                            <h:outputText value=" "/>
                            <p:commandButton action="#{rolController.destroy}" value="Eliminar" ajax="false" update="dataTable"/>
                        </p:column>
                    </p:dataTable>
                </h:panelGroup>
                <br />
                <p:commandButton action="#{rolController.prepareCreate}" value="Crear nuevo" ajax="false"/>                
            </h:form>
        </ui:define>
    </ui:composition>

</html>
